﻿using System;
using System.Collections;
using System.Collections.Generic;
namespace Library.Winform.Draw {
  internal abstract class ListBase<T> : IList<T> {
    protected ListBase() {
      InnerList = new List<T>();
    }
    protected readonly List<T> InnerList;
    public IEnumerator<T> GetEnumerator() {
      return InnerList.GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator() {
      return GetEnumerator();
    }

    public void Add(T item) {
      Insert(Count, item);
    }

    public void Clear() {
      InnerList.Clear();
    }

    public bool Contains(T item) {
      return InnerList.Contains(item);
    }

    public void CopyTo(T[] array, int arrayIndex) {
      throw new NotImplementedException();
    }

    public bool Remove(T item) {
      return InnerList.Remove(item);
    }

    public int Count {
      get { return InnerList.Count; }
    }

    public bool IsReadOnly {
      get { return false; }
    }

    public int IndexOf(T item) {
      return InnerList.IndexOf(item);
    }

    public virtual void Insert(int index, T item) {
      InnerList.Insert(index, item);
    }



    public virtual void RemoveAt(int index) {
      InnerList.RemoveAt(index);
    }

    public T this[int index] {
      get { return InnerList[index]; }
      set { InnerList[index] = value; }
    }
  }
}
